From: Aaron Wyatt Date: Mon, 2 Sep 2019 11:35:55 +0000 (+0200) Subject: convert IPv4-mapped addresses to IPv4 addresses X-Git-Tag: archive/raspbian/2.5.1+ds-1+rpi1~1^2^2^2^2^2^2^2^2^2^2^2^2^2^2^2^2^2^2^2^2^2^2^2^2^2^2^2^2^2^2^2^2~6 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=7dfe11d134a84dc075e45045f6ce5b23b809b00c;p=jacktrip.git convert IPv4-mapped addresses to IPv4 addresses Forwarded: no Last-Update: 2019-09-02 Other clients hang at "Waiting for Peer..." when attempting to connect to jacktrip running as a server. This is because of a change to the way that QHostAddress works in Qt5, resulting in the return of an IPv4-mapped address instead of an IPv4 address. The attached a patch fixes this (restoring the behaviour shown by Qt4). Last-Update: 2019-09-02 Gbp-Pq: Name convert_IPv4.patch --- diff --git a/src/JackTrip.cpp b/src/JackTrip.cpp index 0ae9f39..8f149e7 100644 --- a/src/JackTrip.cpp +++ b/src/JackTrip.cpp @@ -450,7 +450,16 @@ int JackTrip::serverStart(bool timeout, int udpTimeout) UdpSockTemp.readDatagram(buf, 1, &peerHostAddress, &peer_port); UdpSockTemp.close(); // close the socket - mPeerAddress = peerHostAddress.toString(); + // Convert any IPv4-mapped address to an actual IPv4 address + // (Due to a change in the way that QHostAddress works in Qt5) + bool couldConvert; + QHostAddress ipv4Address(peerHostAddress.toIPv4Address(&couldConvert)); + if (couldConvert) { + mPeerAddress = ipv4Address.toString(); + } else { + mPeerAddress = peerHostAddress.toString(); + } + cout << "Client Connection Received from IP : " << qPrintable(mPeerAddress) << endl; cout << gPrintSeparator << endl;